#include "QVideoSourceDemoApplication.hpp"
#include <boost/program_options.hpp>

int main(int argc, char** argv)
{
   /*
   std::string v4l2_device;
   boost::program_options::options_description desc("Allowed options");
   desc.add_options()
      ("help", "Print this help message")
      ("v4l2", boost::program_options::value(&v4l2_device), "Use a video4linux video source")
      ("ueye", "Use a μEye video source");
      //("compression", boost::program_options::value<int>(), "set compression level");
   boost::program_options::variables_map vm;
   boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
   boost::program_options::notify(vm);
   if(vm.count("help"))
      std::cout << desc << std::endl;
   if(vm.count("v4l2"))
   {
      char devname[] = "/dev/video0";
      _pVideoSource = new btl::extra::VideoSourceV4L2(v4l2_device.c_str());
   }*/

   //worked for usb logitech camera
   btl::extra::VideoSource* pVideoSource = new btl::extra::VideoSourceV4L2(std::string("/dev/video0").c_str());

//    btl::extra::VideoSource* pVideoSource = new btl::extra::VideoSourceUEye("/home/pgrad/glynn/shared/btl2/uEye.ini");

   /*
   if(vm.count("ueye"))
   {
      
      //btl::extra::VideoSource* pVideoSource = new btl::extra::VideoSourceUEye("/home/pgrad/glynn/shared/btl2/uEye.ini");
   //}
   
      std::cout << "Compression level set to " << vm["compression"].as<int>() << std::endl;
   else
      std::cout << "Compression level not set" << std::endl;

   if(vm.count("help") && !vm["help"].defaulted() && vm.count("compression") && !vm["compression"].defaulted())
      throw std::logic_error(std::string("Conflicting options"));
      */
   QVideoSourceDemoApplication app(argc, argv, pVideoSource);
   return app.exec();
}
